<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
        <div class="col-xs-6 col-sm-6">
            <input id="c-username" data-rule="required" class="form-control"  name="row[username]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
        <div class="col-xs-6 col-sm-6">
            <input id="c-mobile" data-rule="required" class="form-control"  name="row[mobile]" type="text" value="">
        </div>
    </div>
    <div class="form-group" data-toggle="addresspicker" data-input-id="c-address" data-lat-id="c-lat" data-lng-id="c-lng">
        <label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-address"  class="form-control" name="row[address]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Lat')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-lat" class="form-control" name="row[lat]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Lng')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-lng" class="form-control" name="row[lng]" type="text">
        </div>
    </div>
    <!--<div class="form-group">-->
        <!--<div class="form-group col-xs-12 col-sm-4" style="display: inline-block;">-->
            <!--<label class="control-label col-xs-12 col-sm-2">{:__('Lat')}:</label>-->
            <!--<div class="col-xs-6 col-sm-6">-->
                <!--<input id="c-lat" data-rule="required" class="form-control" step="0.000001" name="row[lat]" type="text" value="">-->
            <!--</div>-->
        <!--</div>-->
        <!--<div class="form-group col-xs-12 col-sm-4" style="display: inline-block">-->
            <!--<label class="control-label col-xs-12 col-sm-2">{:__('Lng')}:</label>-->
            <!--<div class="col-xs-6 col-sm-6">-->
                <!--<input id="c-lng" data-rule="required" class="form-control" step="0.000001" name="row[lng]" type="text" value="">-->
            <!--</div>-->
        <!--</div>-->
        <!--<div class="col-xs-12 col-sm-4">-->
            <!--<input style="display: inline-block;width:120px;text-align: center;height: 30px;margin-left: 45px;" id="weidu" type="text" value="选择坐标" data-toggle="addresspicker"  data-lat-id="c-lat" data-lng-id="c-lng" style="display: inline-block">-->
        <!--</div>-->
    <!--</div>-->

    <!--<div>-->
        <!--<div id="allmap"></div>-->
    <!--</div>-->
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=FMpSeyKyfshy4qcw24MKRBHXodh47KLk"></script>
<script>
    var lng = "119.29649399999994"
    var lat = '26.074508'

    BdMap(lng, lat)

    function BdMap(lng, lat) {
        var sContent = '福州';
        var initLan = '119.29649399999994';
        var initLat = '26.074508';
        if (lng) initLan = lng;
        if (lat) initLat = lat;
        // 百度地图API功能
        // 创建Map实例
        var map = new BMap.Map("allmap", {enableMapClick: false});
        // 初始化地图,设置中心点坐标和地图级别
        map.centerAndZoom(new BMap.Point(initLan, initLat), 15);
        // 设置地图显示的城市 此项是必须设置的
        map.setCurrentCity(sContent);
        map.addControl(new BMap.NavigationControl());//左上角，添加默认缩放平移控件,添加定位控件
        //初始化地图
        var point = new BMap.Point(initLan, initLat);
        map.centerAndZoom(point, 15);
        var marker = new BMap.Marker(point);// 创建标注点
        map.addOverlay(marker);             // 将标注添加到地图中
        map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放

        var lan = '';
        var lat = '';

        //单击获取点击的经纬度
        map.addEventListener("click", function (e) {
            var lan = e.point.lng;
            var lat = e.point.lat;
            map.clearOverlays();//清除原地图;
            coverage();

            //重绘新的标注点
            function coverage() {
                var newPoint = {lng: lan, lat: lat}
                var marker = new BMap.Marker(newPoint);
                map.addOverlay(marker);        // 将标注添加到地图中
                marker.setAnimation(BMAP_ANIMATION_BOUNCE);  //跳动的动画
                map.addOverlay(marker);        //标注点添加到页面
            }
        });
    }
</script>